const {containsEnglishOrAsterisk, isPureChinese, isPureNumber} = require("./string_utils");
const {Op} = require("sequelize");
module .exports.whereName  = function (stock_code) {
    console.log('whereName:stock_code',stock_code)
    let where = {}
    if (containsEnglishOrAsterisk(stock_code)) {
        where = {
            stock_name_first_letter: {
                [Op.like]: `%${stock_code}%`
            }
        }
    } else if (isPureChinese(stock_code)) {
        where = {
            stock_name: {
                [Op.like]: `%${stock_code}%`
            }
        }
    } else if (isPureNumber(stock_code)) {
        where = {
            stock_code: stock_code
        }
    }
    return where
}